<?php
/**
 * トップメニュー作成用 モデルクラス<br />
 *
 * @package apamanshop
 * @author
 * @copyright コピーライト(要確認)
 */
class Mypage_Model_Menu extends Mypage_Model_Base
{
	/**
	 * マイページ トップメニュー　物件情報(検索条件)の取得
	 *
	 * @param $uid ユーザＩＤ
	 * @return array $userDtl[0]
	 */
	public function getKensakuJouken($params)
	{
		//DBパラメータ用配列生成
    	$db_params = array();

		//+++ 最新の検索条件取得
		$sql = "SELECT ";
		$sql .= "T98_USER_CD AS USER_CD";
		$sql .= ", T98_AREA_CD AS AREA_CD";
		$sql .= ", T98_TODOUFUKEN_CD AS TODOUFUKEN_CD";
		$sql .= ", T98_SHIKUCHOUSON_CD AS SHIKUCHOUSON_CD";
		$sql .= ", T98_CHOUMEI_CD AS CHOUMEI_CD";
		$sql .= ", T98_ENSEN_CD AS ENSEN_CD";
		$sql .= ", T98_EKI_CD AS EKI_CD";
		$sql .= ", T98_CHINRYO_MIN AS CHINRYO_MIN";
		$sql .= ", T98_CHINRYO_MAX AS CHINRYO_MAX";
		$sql .= ", T98_CHINRYO_JKN1 AS CHINRYO_JKN1";
		$sql .= ", T98_CHINRYO_JKN2 AS CHINRYO_JKN2";
		$sql .= ", T98_TATEMONO_CD AS TATEMONO_CD";
		$sql .= ", T98_EKI_TOHO AS EKI_TOHO";
		$sql .= ", T98_SENYUU_MENSEKI_MIN AS SENYUU_MENSEKI_MIN";
		$sql .= ", T98_SENYUU_MENSEKI_MAX AS SENYUU_MENSEKI_MAX";
		$sql .= ", T98_MADORI AS MADORI";
		$sql .= ", T98_CHIKUNENN_KBN AS CHIKUNENN_KBN";
		$sql .= ", T98_KOUSHIN_KBN AS KOUSHIN_KBN";
		$sql .= ", T98_SEARCH_TYPE AS SEARCH_TYPE";
		$sql .= ", T98_COMMUTING AS COMMUTING";
		$sql .= ", T98_KODAWARI_JYOKEN AS KODAWARI_JYOKEN";
		$sql .= ", to_char(T98_TOUROKUBI, 'YYYY/MM/DD HH24:MI:SS') AS TOUROKUBI";
		$sql .= ", T98_MYPAGE_KBN AS MYPAGE_KBN";
		$sql .= ", T98_CAMPAIGN_FLAG AS CAMPAIGN_FLAG";
		$sql .= ", T98_CHINRYO_JKN3 AS CHINRYO_JKN3";
		$sql .= ", T98_CHINRYO_JKN4 AS CHINRYO_JKN4 ";
		$sql .= ", T98_PARKING_KOMI_FLAG AS TYUSYAJYO_KOMI  ";
		$sql .= ", T98_MEYASU_CHINRYO_FLAG AS MEYASU_TINRYO  ";
		$sql .= ", T98_SHIKIKIN_ZERO_FLAG AS SHIKIKIN_NASHI  ";
		$sql .= ", T98_REIKIN_ZERO_FLAG AS REIKIN_NASHI  ";
		$sql .= ", T98_BUS_RIYOU_FLAG AS BAS_RIYOU  ";
		$sql .= ", T98_SHOKI_HIYO_KBN AS SYOKIHIYO  ";
		$sql .= "FROM T98SEARCH_PARAM ";
		$sql .= "WHERE T98_USER_CD = '" . $params['Uid'] . "' ";
		if ($params['condition'] != "")
		{
			$sql .= "AND TO_CHAR(T98_TOUROKUBI, 'YYYY/MM/DD HH24:MI:SS')  = '" . $params['condition'] . "' ";
		}
		$sql .= " ORDER BY T98_TOUROKUBI Desc ";

		$userDtl = $this->dbGetList($sql, $db_params);

		return $userDtl[0];
	}


	/**
	 * 表示用コンバート
	 *
	 * @param $uid ユーザＩＤ
	 * @return string $resJouken
	 */
	public function joukenConvert($joukenParams)
	{
		$cnvParams = null;

		//賃料下限
		if (trim($joukenParams['CHINRYO_MIN']) == "0")
		{
			$cnvParams['CNV_T98_CHINRYO_MIN'] = "下限なし";
		}else{
			$cnvParams['CNV_T98_CHINRYO_MIN'] = floor($joukenParams['CHINRYO_MIN']/10000) . "万円";
		}

		//賃料上限
		if (trim($joukenParams['CHINRYO_MAX']) == "9999999")
		{
			$cnvParams['CNV_T98_CHINRYO_MAX'] = "上限なし";
		}else{
			$cnvParams['CNV_T98_CHINRYO_MAX'] = floor($joukenParams['CHINRYO_MAX']/10000) . "万円";
		}
		
		//管理費・共益費込み
		if (trim($joukenParams['CHINRYO_JKN1']) == 0)
		{
			$cnvParams['CNV_T98_CHINRYO_JKN1'] = "";
		}else{
			$cnvParams['CNV_T98_CHINRYO_JKN1'] = "管理費・共益費込み";
		}

		//駐車場代込み
		if (trim($joukenParams['TYUSYAJYO_KOMI']) == 0)
		{
			$cnvParams['CNV_T98_TYUSYAJYO_KOMI'] = "";
		}else{
			$cnvParams['CNV_T98_TYUSYAJYO_KOMI'] = "駐車場代込み";
		}

		//駅徒歩
		//if (trim($joukenParams['T98_EKI_TOHO']) == 0)
		if (trim($joukenParams['EKI_TOHO']) == 0)
		{
			$cnvParams['CNV_T98_EKI_TOHO'] = "指定なし";
		}else{
			$cnvParams['CNV_T98_EKI_TOHO'] = $joukenParams['EKI_TOHO'] . "分以内";
		}

		//専有面積下限
		if (trim($joukenParams['SENYUU_MENSEKI_MIN']) == "1")
		{
			$cnvParams['CNV_T98_SENYUU_MENSEKI_MIN'] = "下限なし";
		}else{
			$cnvParams['CNV_T98_SENYUU_MENSEKI_MIN'] = $joukenParams['SENYUU_MENSEKI_MIN'] . "m<SUP>2</SUP>以上";
		}

		////専有面積上限
		if (trim($joukenParams['SENYUU_MENSEKI_MAX']) == "99999")
		{
			$cnvParams['CNV_T98_SENYUU_MENSEKI_MAX'] = "上限なし";
		}else{
			$cnvParams['CNV_T98_SENYUU_MENSEKI_MAX'] = $joukenParams['SENYUU_MENSEKI_MAX'] . "m<SUP>2</SUP>以内";
		}

		//築年数
		switch (trim($joukenParams['CHIKUNENN_KBN']))
		{
			case "0":
				$cnvParams['CNV_T98_CHIKUNENN_KBN'] = "指定なし";
				break;
			case "1":
				$cnvParams['CNV_T98_CHIKUNENN_KBN'] = "新築";
				break;
			default:
				$cnvParams['CNV_T98_CHIKUNENN_KBN'] = $joukenParams['CHIKUNENN_KBN'] . "年以内";
		}

		//情報
		switch (trim($joukenParams['KOUSHIN_KBN']))
		{
			case "0":
				$cnvParams['CNV_T98_KOUSHIN_KBN'] = "指定なし";
				break;
			case "1":
				$cnvParams['CNV_T98_KOUSHIN_KBN'] = "新築";
				break;
			default:
				$cnvParams['CNV_T98_KOUSHIN_KBN'] = $joukenParams['KOUSHIN_KBN'] . "日以内";
		}

		//登録日
		$cnvParams['CNV_T98_TOUROKUBI'] = substr(date('Y/m/d H:i:s', strtotime(trim($joukenParams['TOUROKUBI']))),2,17);

		//キャンペーン
		if (trim($joukenParams['CAMPAIGN_FLAG']) == 1)
		{
			$cnvParams['CNV_T98_CAMPAIGN_FLAG'] = "キャンペーン対象";
		}else{
			$cnvParams['CNV_T98_CAMPAIGN_FLAG'] = "指定なし";
		}

		//こだわり条件
		$cnvParams['CNV_T98_KODAWARI_JYOKEN'] = $this->GetKodawariName($joukenParams['KODAWARI_JYOKEN']);

		//建物種別
		$cnvParams['CNV_T98_TATEMONO_CD'] = $this->GetTatemonoName($joukenParams['TATEMONO_CD']);
		//間取り
		$cnvParams['CNV_T98_MADORI'] = $this->GetMadoriName($joukenParams['MADORI']);
		//初期費用
		$cnvParams['CNV_T98_SYOKIHIYO'] = $this->GetSyokiHiyo($joukenParams['SYOKIHIYO']);
		//バス利用
		$cnvParams['CNV_T98_BAS_RIYOU'] = $joukenParams['BAS_RIYOU'];


		return $cnvParams;
	}


	public function GetSyokiHiyo($syokihiyo)
	{
		$strSyokihiyo = "";
		
		if((is_null($syokihiyo))||($syokihiyo=="0"))
		{
			$strSyokihiyo = "指定なし";
		}else if($syokihiyo=="w0"){
			$strSyokihiyo = "ダブルゼロ";
		}else{
			$strSyokihiyo = "～".$syokihiyo."万円";
		}
		
		return $strSyokihiyo;
	}


	/**
	 * 表示用建物種別名取得
	 *
	 * @param $tatemonoCd
	 * @return string $strTatemono
	 */
	public function GetTatemonoName($tatemonoCd)
	{
		$strTatemono = "";

		if (!(is_null($tatemonoCd)) && !($tatemonoCd == ""))
		{
			//建物CD:配列
			$arrTatemono = explode(",",$tatemonoCd);
			for($i = 0;$i < count($arrTatemono);$i++)
			{
				switch ($arrTatemono[$i])
				{
					case "1":
						$strTatemono .= "[ｱﾊﾟｰﾄ・ｺｰﾎﾟ]";
						break;
					case "2":
						$strTatemono .= "[ﾏﾝｼｮﾝ]";
						break;
					case "3":
//						$strTatemono .= "[1戸建て]";
						$strTatemono .= "[戸建て・ﾃﾗｽﾊｳｽ]";
						break;
					case "4":
						$strTatemono .= "[駐車場]";
						break;
					case "5":
						$strTatemono .= "[ﾃﾅﾝﾄ(店舗・事務所)]";
						break;
					case "6":
						$strTatemono .= "[その他]";
						break;
					case "7":
						$strTatemono .= "[ﾃﾗｽﾊｳｽ・ﾀｳﾝﾊｳｽ]";
						break;
				}
			}
		}else{
			$strTatemono = "全て";
		}

		return $strTatemono;
	}

	/**
	 * 表示用　間取り名取得
	 *
	 * @param $madoriCd
	 * @return string $strMadori
	 */
	private function GetMadoriName($madoriCd)
	{
		$strMadori = "";

		if (!(is_null($madoriCd)) && !($madoriCd == ""))
		{
			if (strpos($madoriCd,"9") > 0)
			{
				$strMadori = "[すべて]";
			}else{
				//間取りCD:配列
				$arrMadori = explode(",",$madoriCd);
				for($i = 0;$i < count($arrMadori);$i++)
				{
					switch ($arrMadori[$i])
					{
						case "1":
							$strMadori .= "[1R]";
							break;
						case "2":
							$strMadori .= "[1K][1DK]";
							break;
						case "3":
							$strMadori .= "[1LDK]";
							break;
						case "4":
							$strMadori .= "[2K][2DK]";
							break;
						case "5":
							$strMadori .= "[2LDK]";
							break;
						case "6":
							$strMadori .= "[3K][3DK]";
							break;
						case "7":
							$strMadori .= "[3LDK]";
							break;
						case "8":
							$strMadori .= "[4K～]";
							break;
						case "10":
							$strMadori .= "[1R]";
							break;
						case "11":
							$strMadori .= "[1K]";
							break;
						case "12":
							$strMadori .= "[1DK(+S)]";
							break;
						case "14":
							$strMadori .= "[1LDK(+S)]";
							break;
						case "21":
							$strMadori .= "[2K]";
							break;
						case "22":
							$strMadori .= "[2DK(+S)]";
							break;
						case "24":
							$strMadori .= "[2LDK(+S)]";
							break;
						case "31":
							$strMadori .= "[3K]";
							break;
						case "32":
							$strMadori .= "[3DK(+S)]";
							break;
						case "34":
							$strMadori .= "[3LDK(+S)]";
							break;
						case "41":
							$strMadori .= "[4K]";
							break;
						case "42":
							$strMadori .= "[4DK(+S)]";
							break;
						case "44":
							$strMadori .= "[4LDK(+S)]";
							break;
						case "51":
							$strMadori .= "[5K～]";
							break;
					}
				}
			}
		}

		return $strMadori;
	}






     /**
	 * 表示用こだわり条件名取得
	 *
	 * @param $kodawariCd
	 * @return string $strKodawari
	 */
	private function GetKodawariName($kodawariCd)
	{
		//こだわり条件
		$strKidMax = strlen(trim($kodawariCd));

		if(is_null($strKidMax) || $strKidMax == "")
		{
			$strKidMax = 0;
		}

		for ($k = 1; $k <= $strKidMax; $k++)
		{
			if (substr($kodawariCd, $k - 1,1) == 1)
			{
				$Kjyoken .= "OR W74_KODAWARI_ID = " . $k . " ";
			}
		}

		//DBパラメータ用配列生成
    	$db_params = array();

		//+++ 最新の検索条件取得
		$sql = "";
		$sql .= "SELECT W74_KODAWARI_NAME ";
		$sql .= "FROM ";
		$sql .= "W74KODAWARI ";
		$sql .= "WHERE ";
		$sql .= "W74_KODAWARI_ID = 0 ";
		$sql .= $Kjyoken;
		$sql .= "ORDER BY W74_KODAWARI_TYPE,W74_KODAWARI_ID ";

		$userDtl = $this->dbGetList($sql, $db_params);

		$strKodawari = "";

		//ﾃﾞｰﾀが存在していた場合
		if ($userDtl[0]['W74_KODAWARI_NAME'] != "")
		{
			for($i = 0; $i < count($userDtl); $i++)
			{
				if ($i != 0)
				{
					if($strKodawari == "")
					{
						$strKodawari .= $userDtl[$i]['W74_KODAWARI_NAME'];
					}else{
						$strKodawari .= "/" . $userDtl[$i]['W74_KODAWARI_NAME'];
					}
				}
			}
		}

		return $strKodawari;
	}


     /**
	 * エリア取得
	 *
	 * @param $uid ユーザＩＤ
	 * @return array $arrCity
	 */
	public function getCity($params)
	{
		//DBパラメータ用配列生成
    	$db_params = array();

		//+++ City取得
		$sql = "";
		$sql .= "SELECT NVL(NVL(T98_CHOUMEI_CD, T98_SHIKUCHOUSON_CD), T98_TODOUFUKEN_CD) AS CITYCD ";
		$sql .= "FROM T98SEARCH_PARAM ";
		$sql .= "WHERE T98_USER_CD = '" . $params['Uid'] . "' ";
		if ($params['condition'] != "")
		{
			$sql .= "AND TO_CHAR(T98_TOUROKUBI, 'YYYY/MM/DD HH24:MI:SS')  = '" . $params['condition'] . "' ";

		}
		$sql .= "ORDER BY T98_TOUROKUBI Desc  ";

		$rsPreCity = $this->dbGetList($sql, $db_params);

		if ($rsPreCity[0]['CITYCD'] != "")
		{
			$arrPreCity = explode(",",$rsPreCity[0]['CITYCD']);

			for($j = 0;$j < count($arrPreCity);$j++)
			{
				if(strlen($arrPreCity[$j]) > 5)
				{
					$strSQL = "";
					$strSQL .= "SELECT M01_TODOUFUKEN, M01_SHIKUCHOUSON, M01_CHOUMEI ";
					$strSQL .= "FROM M01JYUUSHO ";
					$strSQL .= "WHERE M01_TODOUFUKEN_CD = '" . substr(trim($arrPreCity[$j]),0,2) . "' ";
					$strSQL .= "AND M01_SHIKUCHOUSON_CD = '" . substr(trim($arrPreCity[$j]),2,3) . "' ";
					$strSQL .= "AND M01_CHOUMEI_CD = '" . substr(trim($arrPreCity[$j]),5,3) . "' ";
				}
				elseif(strlen($arrPreCity[$j]) == 2)
				{
					$strSQL = "";
					$strSQL .= "SELECT M01_TODOUFUKEN ";
					$strSQL .= "FROM M01JYUUSHO ";
					$strSQL .= "WHERE M01_TODOUFUKEN_CD = '" . trim($arrPreCity[$j]) . "' ";
				}
				else
				{
					$strSQL = "";
					$strSQL .= "SELECT M01_TODOUFUKEN, M01_SHIKUCHOUSON ";
					$strSQL .= "FROM M01JYUUSHO ";
					$strSQL .= "WHERE M01_TODOUFUKEN_CD = '" . substr(trim($arrPreCity[$j]),0,2) . "' ";
					$strSQL .= "AND M01_SHIKUCHOUSON_CD = '" . substr(trim($arrPreCity[$j]),2,3) . "' ";
				}

				$rsCity = $this->dbGetList($strSQL, $db_params);

				if ($rsCity[0]['M01_TODOUFUKEN'] != "")
				{
					if(strlen($arrPreCity[$j]) > 5)
					{
						$arrCity[$j] = $rsCity[0]['M01_TODOUFUKEN'] . $rsCity[0]['M01_SHIKUCHOUSON'] . $rsCity[0]['M01_CHOUMEI'];
					}
					elseif(strlen($arrPreCity[$j]) == 2)
					{
						$arrCity[$j] = $rsCity[0]['M01_TODOUFUKEN'];
					}
					else
					{
						$arrCity[$j] = $rsCity[0]['M01_TODOUFUKEN'] . $rsCity[0]['M01_SHIKUCHOUSON'];
					}
					$rsCity = null;
				}
			}
		}
		$rsPreCity = null;

		return $arrCity;
	}


/**
	 * 沿線取得
	 *
	 * @param $uid ユーザＩＤ
	 * @return array $arrCity
	 */
	public function getStation($params)
	{
		//DBパラメータ用配列生成
    	$db_params = array();

		//+++ エリア・沿線取得取得
		$sql = "";
		$sql .= "SELECT  T98_SEARCH_TYPE, T98_COMMUTING, ";
		$sql .= "(CASE WHEN T98_EKI_CD IS NOT NULL THEN T98_EKI_CD ";
		$sql .= "  WHEN T98_ENSEN_CD IS NOT NULL THEN T98_ENSEN_CD END) AS STATIONCD ";
		$sql .= "FROM T98SEARCH_PARAM ";
		$sql .= "WHERE T98_USER_CD = '" . $params['Uid'] . "' ";
		if($params['condition'] != "")
		{
			$sql .= "AND TO_CHAR(T98_TOUROKUBI, 'YYYY/MM/DD HH24:MI:SS')  = '" . $params['condition'] . "' ";
		}
		$sql .= "ORDER BY T98_TOUROKUBI Desc ";

		$rsPreStation = $this->dbGetList($sql, $db_params);

		$arrStation = "";

		if ($rsPreStation[0]['T98_COMMUTING'] != "")
		{
			$arrRosenEki = explode(",",str_replace(" ","",$rsPreStation[0]['T98_COMMUTING']));

			$sql = "";
			$sql .= " SELECT DISTINCT";
			$sql .= " M03_ENSEN_NAME AS ENSEN_NAME,";
			$sql .= " M03_EKI_NAME AS EKI_NAME,";
			$sql .= " M43_TODOUFUKEN AS TODOUFUKEN ,M03_ENSEN_CD";
			$sql .= " FROM M03EKI, M43TODOUFUKEN";
			$sql .= " WHERE (M03_ROSENZU_EKI_CD = '" . $arrRosenEki[0] . "'";
			$sql .= ") AND M43_TODOUFUKEN_CD = M03_TODOUFUKEN_CD ORDER BY M03_ENSEN_CD";

			$rsRosenStation = $this->dbGetList($sql, $db_params);

			if ($rsRosenStation[0]['ENSEN_NAME'])
			{
				$strBk1 = "";
				$strBk2 = "";
				for ($i = 0; $i < count($rsRosenStation); $i++)
				{
					if ($strBk1 == $rsRosenStation[$i]['TODOUFUKEN'] && $strBk2 == $rsRosenStation[$i]['ENSEN_NAME'])
					{
						$arrStation .= ", " . $rsRosenStation[$i]['EKI_NAME'] . "駅";
					}else{
						if ($arrStation != "")
						{
							$arrStation .= "<br />";
						}
						$arrStation .= "[ " . $rsRosenStation[$i]['TODOUFUKEN'] . $rsRosenStation[$i]['ENSEN_NAME'] . "内 ] " . $rsRosenStation[$i]['EKI_NAME'] . "駅";
						$strBk1 = $rsRosenStation[$i]['TODOUFUKEN'];
						$strBk2 = $rsRosenStation[$i]['ENSEN_NAME'];
					}
					$arrStation .= "より　" . $arrRosenEki[1] . "分<br />";
				}
			}
			$rsRosenStation = null;

		}else{
			if ($rsPreStation[0]['STATIONCD'] != "")
			{
				$arrPreStation = explode(",",$rsPreStation[0]['STATIONCD']);

				for ($j = 0; $j < count($arrPreStation);$j++)
				{
					if (strlen($arrPreStation[$j]) > 4)
					{
						$strSQL = "";
						$strSQL .= "SELECT M03_ENSEN_NAME, M03_EKI_NAME ";
						$strSQL .= "FROM M03EKI ";
						if ($rsPreStation[0]['T98_SEARCH_TYPE'] == "07")
						{
							$strSQL1 = "";
							$strSQL1 .= "SELECT M03_EKI_CD ";
							$strSQL1 .= "FROM M03EKI ";
							$strSQL1 .= "WHERE M03_ROSENZU_EKI_CD = '" . trim($arrPreStsation[$j]) . "' ";

							$rsRosenStation = $this->dbGetList($strSQL1, $db_params);

							$strRosenEki = "";

							for ($i=0;$i<count($rsRosenStation);$i++)
							{
								if ($strRosenEki = "")
								{
									$strRosenEki = "WHERE M03_EKI_CD = '" . trim($rsRosenStation[$i]['M03_EKI_CD']) . "' ";
								}else{
									$strRosenEki .= "OR M03_EKI_CD = '" . trim($rsRosenStation[$i]['M03_EKI_CD']) . "' ";
								}
							}
							$rsRosenStation = null;
							$strSQL .= $strRosenEki;
						}else{
							$strSQL .= "WHERE M03_EKI_CD = '" . substr(Trim($arrPreStation[$j]),-7) . "' ";
						}
					}else{
						$strSQL = "";
						$strSQL .= "SELECT M03_ENSEN_NAME ";
						$strSQL .= "FROM M03EKI ";
						$strSQL .= "WHERE M03_ENSEN_CD = '" . trim($arrPreStaton[$j]) . "' ";
					}

					$rsStation = $this->dbGetList($strSQL, $db_params);
					if($rsStation[0]['M03_ENSEN_NAME'] != "")
					{
						if(strlen($arrPreStation[$j]) > 4)
						{
							if($rsPreStation['T98_SEARCH_TYPE'] == "07")
							{
								for ($i = 0;$i <count($rsStation);$i++)
								{
									if($arrStation != "")
									{
										$arrStation .= "<br />";
									}
									$arrStation .= $rsStation[0]['M03_ENSEN_NAME'] . $rsStation[0]['M03_EKI_NAME'];
								}
							}else{
								if ($arrStation != "")
								{
									$arrStation .= "<br / >";
								}
								$arrStation .=  $rsStation[0]['M03_ENSEN_NAME'] . $rsStation[0]['M03_EKI_NAME'];
							}
						}else{
							if ($arrStation != "")
							{
								$arrStation .= "<br />";
							}
							$arrStation .= $rsStation[0]['M03_ENSEN_NAME'];
						}
					}
					else if ($rsStation[0]['M03_EKI_NAME'] != "")
					{
						if ($arrStation != "")
						{
							$arrStation .= "<br />";
						}
						$arrStation .= $rsStation[0]['M03_EKI_NAME'];
					}
					else{
						//$arrStation = "";
					}
					$rsStation = null;
				}
				$arrStation .= "<br />";
			}
		}
		$rsPreStation = null;

		return $arrStation;
	}


	/**
     * 交通機関文字列取得
     *
     * @param array  $rsBukken 物件情報レコードセットの連想配列
     * @param string $trafficNo 交通機関番号
     * @return string 交通機関文字列
     */
    public static function GetTrafficStr($rsBukken)
    {
        $strWork="";

        $strTrainNm = $rsBukken["T03_ENSEN_NAME"];
        $strStationNm = $rsBukken["T03_EKI_NAME"];
        $strStationCd = $rsBukken["T03_ENSEN_CD01"];
        $strBusJyousha = $rsBukken["T03_BUS_JYOUSHA"];
        $strBusStop = $rsBukken["T03_BUS_STOP"];
        $strToho = $rsBukken["T03_TOHO01"];

        //=====================================================
        //= @ 交通機関タグ作成
        //=====================================================

        //駅名称が設定されている場合
        if (($strStationNm != "") && ($strStationNm != "＊＊＊＊") && ($strStationNm != "＊＊＊")){

        	//ﾊﾞｽ乗車時間＞０であった場合
            if (intval($strBusJyousha)>0){

                //徒歩分＞０であった場合
                if (intval($strToho)>0){
                    $strWork=$strWork." 停歩";
                }
            }
            //上記以外であった場合
            else{
                //徒歩分＞０であった場合
                if (intval($strToho)>0){
                    $strWork=$strWork." 徒歩";
                }
            }
            //@ 徒歩
            //徒歩分＞０であった場合
            if (intval($strToho)>0){
                $strWork=$strWork." ".$strToho."分";
            }
        }

        //沿線がﾊﾞｽであった場合
        elseif (
                   $strStationCd=="3500" || $strStationCd=="3501" || $strStationCd=="3502" || $strStationCd=="3503"
                || $strStationCd=="3504" || $strStationCd=="3505" || $strStationCd=="3506" || $strStationCd=="3507"
                || $strStationCd=="3508" || $strStationCd=="3509" || $strStationCd=="3510" || $strStationCd=="3511"
               ){
            //@ 徒歩
            //徒歩分＞０であった場合
            if (intval($strToho)>0){
                $strWork=$strWork." 徒歩".$strToho."分";
            }
        }

        //上記以外であった場合
        else{
            $strWork=$strWork."－";
        }

        return $strWork;
    }




}
?>